package com.gdziarmaga.webshop.utils.filtering;

import org.hibernate.criterion.MatchMode;

public class FilterField<T> {
	/**
	 * The value.
	 */
	private T value;
	/**
	 * Domain object's field name.
	 */
	private String fieldName;
	/**
	 * The comparison type.
	 */
	private FilterComparisonType comparisonType;
	/**
	 * The mact mode.
	 */
	private MatchMode matchMode;

	/**
	 * Short Constructor. Sets {@link MatchMode} to {@link MatchMode#START}
	 * 
	 * @param value
	 *            the value
	 * @param fieldName
	 *            the domain object's field name
	 * @param comparisonType
	 *            the {@link FilterComparisonType}
	 */
	public FilterField(T value, String fieldName,
			FilterComparisonType comparisonType) {
		this.value = value;
		this.fieldName = fieldName;
		this.comparisonType = comparisonType;
		this.matchMode = MatchMode.EXACT;
	}

	/**
	 * Full Constructor.
	 * 
	 * @param value
	 *            the value
	 * @param fieldName
	 *            the domain object's field name
	 * @param comparisonType
	 *            the {@link FilterComparisonType}
	 * @param matchMode
	 *            the {@link MatchMode}
	 */
	public FilterField(T value, String fieldName,
			FilterComparisonType comparisonType, MatchMode matchMode) {
		this.value = value;
		this.fieldName = fieldName;
		this.comparisonType = comparisonType;
		this.matchMode = matchMode;
	}

	/**
	 * Getter for value.
	 * 
	 * @return the value
	 */
	public T getValue() {
		return value;
	}

	/**
	 * Setter for value.
	 * 
	 * @param value
	 *            the value to set
	 */
	public void setValue(T value) {
		this.value = value;
	}

	/**
	 * Getter for fieldName.
	 * 
	 * @return the fieldName
	 */
	public String getFieldName() {
		return fieldName;
	}

	/**
	 * Setter for fieldName.
	 * 
	 * @param fieldName
	 *            the fieldName to set
	 */
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	/**
	 * Getter for comparisonType.
	 * 
	 * @return the comparisonType
	 */
	public FilterComparisonType getComparisonType() {
		return comparisonType;
	}

	/**
	 * Setter for comparisonType.
	 * 
	 * @param comparisonType
	 *            the comparisonType to set
	 */
	public void setComparisonType(FilterComparisonType comparisonType) {
		this.comparisonType = comparisonType;
	}

	/**
	 * Getter for matchMode.
	 * 
	 * @return the matchMode
	 */
	public MatchMode getMatchMode() {
		return matchMode;
	}

	/**
	 * Setter for matchMode.
	 * 
	 * @param matchMode
	 *            the matchMode to set
	 */
	public void setMatchMode(MatchMode matchMode) {
		this.matchMode = matchMode;
	}

}
